package phase2.rd;

import java.io.PrintStream;

/**
 * 
 * 
 * @author John Girata
 * @version Dec 5, 2012
 */
public class BinaryNode extends Node {
	private Node left;
	private Node right;

	public BinaryNode(String value) {
		super(value);
	}

	public Node getLeft() {
		return left;
	}

	public void setLeft(Node left) {
		this.left = left;
	}

	public Node getRight() {
		return right;
	}

	public void setRight(Node right) {
		this.right = right;
	}

	@Override
	public void print(PrintStream out) {
		StringBuilder builder = new StringBuilder();
		builder.append(getId() + VALUE_SEPARATOR + getValue());

		left.print(out);
		builder.append(VALUE_SEPARATOR + left.getId());

		right.print(out);
		builder.append(VALUE_SEPARATOR + right.getId());

		out.println(builder.toString());
	}
}
